
        <html>
			<head>
			     <title>Mysql安全配置 - zhangsan</title>
				 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
			</head>
			<body>
				<h1>原文地址:<a href="http://drops.wooyun.org/tips/2245">http://drops.wooyun.org/tips/2245</a></h1>
				
      <p>
        <h2>0x01 前言</h2>

<hr />

<p>很多文章中会说，数据库的权限按最小权限为原则，这句话本身没有错，但是却是一句空话。因为最小权限，这个东西太抽象，很多时候你并弄不清楚具体他需要哪些权限。 现在很多mysql用着root账户在操作，并不是大家不知道用root权限太大不安全，而是很多人并不知道该给予什么样的权限既安全又能保证正常运行。所以，本文更多的是考虑这种情况下，我们该如何简单的配置一个安全的mysql。注：本文测试环境为mysql-5.6.4</p>

<h2>0x02 Mysql权限介绍</h2>

<hr />

<p>mysql中存在4个控制权限的表，分别为user表，db表，tables&#95;priv表，columns&#95;priv表。</p>

<p>mysql权限表的验证过程为：</p>

<!--more-->

<pre><code>1,先从user表中的Host,User,Password这3个字段中判断连接的ip、用户名、密码是否存在，存在则通过验证。
2,通过身份认证后，进行权限分配，按照user，db，tables_priv，columns_priv的顺序进行验证。即先检查全局权限表user，如果user中对应的权限为Y，则此用户对所有数据库的权限都为Y，将不再检查db, tables_priv,columns_priv；如果为N，则到db表中检查此用户对应的具体数据库，并得到db中为Y的权限；如果db中为N，则检查tables_priv中此数据库对应的具体表，取得表中的权限Y，以此类推。
</code></pre>

<h2>0x03 mysql有哪些权限</h2>

<hr />

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%" style="width:100.0%;border-collapse:collapse"> 

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style="width:25.88%;border:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt"> <p class=MsoNormal align=left style="text-align:left"><b><span>权限</span></b></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border:solid windowtext 1.0pt; border-left:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><b><span>权限级别</span></b></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border:solid windowtext 1.0pt; border-left:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><b><span>权限说明</span></b></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>CREATE</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>数据库、表或索引</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>创建数据库、表或索引权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>DROP</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>数据库或表</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>删除数据库或表权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>GRANT OPTION</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>数据库、表或保存的程序</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>赋予权限选项</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>REFERENCES</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>数据库或表</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>　</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>ALTER</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>表</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>更改表，比如添加字段、索引等</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>DELETE</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>表</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>删除数据权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>INDEX</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>表</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>索引权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>INSERT</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>表</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>插入权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>SELECT</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>表</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>查询权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>UPDATE</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>表</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>更新权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>CREATE VIEW</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>视图</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>创建视图权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>SHOW VIEW</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>视图</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>查看视图权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>ALTER ROUTINE</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>存储过程</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>更改存储过程权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>CREATE ROUTINE</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>存储过程</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>创建存储过程权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>EXECUTE</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>存储过程</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>执行存储过程权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>FILE</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>服务器主机上的文件访问</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>文件访问权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>CREATE TEMPORARY TABLES</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>服务器管理</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>创建临时表权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>LOCK TABLES</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>服务器管理</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>锁表权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>CREATE USER</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>服务器管理</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>创建用户权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>PROCESS</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>服务器管理</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>查看进程权限</span></p> </td>
</tr>

<tr style='height:54.75pt'>
  <td width="25%" nowrap style='width:25.88%;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:54.75pt'>
    <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>RELOAD</span></p>
  </td>
  
  <td width="34%" nowrap style='width:34.44%;border-top:none;border-left:none;
  border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:54.75pt'>
    <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>服务器管理</span></p>
  </td><td width="39%" valign=bottom style='width:39.68%;border-top:none;border-left: none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:54.75pt'> <p class=MsoNormal align=left style='text-align:left'> 
  
  <span style='font-size:
  11.0pt;font-family:宋体;color:black'>执行<span lang=EN-US>flush-hosts, flush-logs, flush-privileges, flush-status, flush-tables, flush-threads, refresh, reload</span>等命令的权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>REPLICATION CLIENT</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>服务器管理</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>复制权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>REPLICATION SLAVE</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>服务器管理</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>复制权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>SHOW DATABASES</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>服务器管理</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>查看数据库权限</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>SHUTDOWN</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>服务器管理</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>关闭数据库权限</span></p> </td>
</tr>

<tr style='height:14.25pt'>
  <td width="25%" nowrap valign=bottom style='width:25.88%;border:solid windowtext 1.0pt; border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:14.25pt'> <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US style='font-size:11.0pt;font-family:宋体;color:black'>SUPER</span></p> </td> <td width="34%" nowrap valign=bottom style='width:34.44%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:14.25pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>服务器管理</span></p> </td> <td width="39%" nowrap valign=bottom style='width:39.68%;border-top:none; border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt;height:14.25pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>执行<span lang=EN-US>kill</span>线程权限</span></p> </td>
</tr></table>

<h2>0x04 数据库层面（db表）的权限分析</h2>

<hr />

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 style='margin-left:4.65pt;border-collapse:collapse'> 

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><b><span>权限</span></b></p> </td> <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-left: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><b><span>说明</span></b></p> </td> <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-left: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><b><span>网站使用账户是否给予</span></b></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span>Select    </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可对其下所有表进行查询</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span>Insert             </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可对其下所有表进行插入</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Update                </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可对其下所有表进行更新</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Delete                    </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可对其下所有表进行删除</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Create                   </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可在此数据库下创建表或者索引</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Drop                  </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可删除此数据库，及此数据库下的表</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>不建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Grant                </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>赋予权限选项</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>不建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >References              </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>未来<span lang=EN-US>MySQL</span>特性的占位符</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>不建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Index                 </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可对其下的所有表进行索引</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Alter                   </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可对其下的所有表进行更改</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Create_tmp_table           </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>创建临时表</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>不建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Lock_tables              </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可对其下所有表进行锁定</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>不建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Create_view               </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可在此数据下创建视图</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Show_view              </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可在此数据下查看视图</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Create_routine          </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可在此数据下创建存储过程</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>不建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Alter_routine         </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可在此数据下更改存储过程</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>不建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Execute          </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可在此数据下执行存储过程</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>不建议给予</span></p> </td>
</tr>

<tr style='height:13.5pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span >Event                </span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可在此数据下创建事件调度器</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:13.5pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>不建议给予</span></p> </td>
</tr>

<tr style='height:14.25pt'>
  <td nowrap valign=bottom style='border:solid windowtext 1.0pt;border-top: none;padding:0cm 5.4pt 0cm 5.4pt;height:14.25pt'> <p class=MsoNormal align=left style='text-align:left'><span >Trigger</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:14.25pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>可在此数据下创建触发器</span></p> </td> <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom: solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:14.25pt'> <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
  11.0pt;font-family:宋体;color:black'>不建议给予</span></p> </td>
</tr></table>

<h2>0x05 mysql安全配置方案</h2>

<hr />

<p>1 限制访问mysql端口的ip</p>

<p>windows可以通过windows防火墙或者ipsec来限制，linux下可以通过iptables来限制。</p>

<p>2 修改mysql的端口</p>

<p>windows下可以修改配置文件my.ini来实现，linux可以修改配置文件my.cnf来实现。</p>

<p>3 对所有用户设置强密码并严格指定对应账号的访问ip</p>

<p>mysql中可在user表中指定用户的访问可访问ip</p>

<p>4 root特权账号的处理</p>

<p>建议给root账号设置强密码，并指定只容许本地登录</p>

<p>5 日志的处理</p>

<p>如需要可开启查询日志，查询日志会记录登录和查询语句。</p>

<p>6 mysql进程运行账号</p>

<p>在windows下禁止使用local system来运行mysql账户，可以考虑使用network service或者自己新建一个账号，但是必须给与mysql程序所在目录的读取权限和data目录的读取和写入权限； 在linux下，新建一个mysql账号，并在安装的时候就指定mysql以mysql账户来运行，给与程序所在目录的读取权限，data所在目录的读取和写入权限。</p>

<p>7 mysql运行账号的磁盘权限</p>

<pre><code>1)mysql运行账号需要给予程序所在目录的读取权限，以及data目录的读取和写入权限 
2)不容许给予其他目录的写入和执行权限，特别是有网站的。 
3)取消mysql运行账户对于cmd，sh等一些程序的执行权限。
</code></pre>

<p>8 网站使用的mysql账户的处理</p>

<p>新建一个账户，给予账户在所使用数据库的所有权限即可。这样既能保证网站对所对应的数据库的全部操作，也能保证账户不会因为权限过高而影响安全。给予单个数据库的所有权限的账户不会拥有super， process， file等管理权限的。 当然，如果能很明确是的知道，我的网站需要哪些权限，还是不要多给权限，因为很多时候发布者并不知道网站需要哪些权限，我才建议上面的配置。而且我指的通用的，具体到只有几台机器，不多的情况下，我个人建议还是给予只需要的权限，具体可参考上面的表格的建议。</p>

<p>9 删除无用数据库</p>

<p>test数据库对新建的账户默认有权限</p>

<h2>0x06 mysql入侵提权分析及防止措施</h2>

<hr />

<p>一般来说，mysql的提权有这么几种方式：</p>

<p>1 udf提权 此方式的关键导入一个dll文件，个人认为只要合理控制了进程账户对目录的写入权限即可防止被导入dll文件；然后如果万一被攻破，此时只要进程账户的权限够低，也没办执行高危操作，如添加账户等。</p>

<p>2 写入启动文件</p>

<p>这种方式同上，还是要合理控制进程账户对目录的写入权限。</p>

<p>3 当root账户被泄露</p>

<p>如果没有合理管理root账户导致root账户被入侵，此时数据库信息肯定是没办法保证了。但是如果对进程账户的权限控制住，以及其对磁盘的权限控制，服务器还是能够保证不被沦陷的。</p>

<p>4 普通账户泄露（上述所说的，只对某个库有所有权限的账户）</p>

<p>此处说的普通账户指网站使用的账户，我给的一个比较方便的建议是直接给予特定库的所有权限。账户泄露包括存在注入及web服务器被入侵后直接拿到数据库账户密码。</p>

<p>此时，对应的那个数据库数据不保，但是不会威胁到其他数据库。而且这里的普通账户无file权限，所有不能导出文件到磁盘，当然此时还是会对进程的账户的权限严格控制。</p>

<p>普通账户给予什么样的权限可以见上表，实在不会就直接给予一个库的所有权限。</p>

<h2>0x07 安全配置需要的常用命令</h2>

<hr />

<p>1.新建一个用户并给予相应数据库的权限</p>

<pre><code>grant select,insert,update,delete,create,drop privileges on database.* to <a class="__cf_email__" href="/cdn-cgi/l/email-protection" data-cfemail="3f4a4c5a4d7f53505c5e5357504c4b">[email&#160;protected]</a><script data-cfhash='f9e31' type="text/javascript">/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */</script> identified by 'passwd';

grant all privileges on database.* to <a class="__cf_email__" href="/cdn-cgi/l/email-protection" data-cfemail="cebbbdabbc8ea2a1adafa2a6a1bdba">[email&#160;protected]</a><script data-cfhash='f9e31' type="text/javascript">/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */</script> identified by 'passwd';
</code></pre>

<p>2.刷新权限</p>

<pre><code>flush privileges;
</code></pre>

<p>3. 显示授权</p>

<pre><code>show grants;
</code></pre>

<p>4. 移除授权</p>

<pre><code>revoke delete on *.* from 'jack'@'localhost';
</code></pre>

<p>5. 删除用户</p>

<pre><code>drop user 'jack'@'localhost';
</code></pre>

<p>6. 给用户改名</p>

<pre><code>rename user 'jack'@'%' to 'jim'@'%';
</code></pre>

<p>7. 给用户改密码</p>

<pre><code>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
</code></pre>

<p>8. 删除数据库</p>

<pre><code>drop database test;
</code></pre>

<p>9. 从数据库导出文件</p>

<pre><code>select * from a into outfile "d:\abc.vbs"
</code></pre>      </p>
    
			</body>
		</html>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          